package com.molichuxing.gateway.api.services.impl;

import com.molichuxing.framework.dto.Paged;
import com.molichuxing.framework.exception.BizException;
import com.molichuxing.framework.result.ResponseCodeEnum;
import com.molichuxing.framework.result.ResponseResult;
import com.molichuxing.framework.utils.DateUtil;
import com.molichuxing.framework.utils.DownloadFileUtil;
import com.molichuxing.framework.utils.ObjectCastUtil;
import com.molichuxing.gateway.api.config.OptionalLogConfig;
import com.molichuxing.gateway.api.services.OrderApiService;
import com.molichuxing.gateway.bff.car.entity.response.CarsMileageMonitoringEnterpriseVo;
import com.molichuxing.gateway.bff.car.entity.response.CarsMileageWarnEnterpriseVo;
import com.molichuxing.gateway.bff.car.services.CarsMileageMonitoringService;
import com.molichuxing.gateway.bff.financial.entity.response.DeliveryVo;
import com.molichuxing.gateway.bff.financial.services.ContractBffService;
import com.molichuxing.gateway.bff.order.entity.request.create.*;
import com.molichuxing.gateway.bff.order.entity.request.modify.*;
import com.molichuxing.gateway.bff.order.entity.response.*;
import com.molichuxing.gateway.bff.order.services.*;
import com.molichuxing.gateway.bff.payment.entity.response.OfflineBookyueVo;
import com.molichuxing.gateway.bff.payment.services.EscrowLogBffService;
import com.molichuxing.gateway.utils.ContantsUtil;
import com.molichuxing.gateway.utils.PoiExcelUtil;
import com.molichuxing.gateway.utils.TokenUtil;
import com.molichuxing.services.property.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 订单相关接口
 * 
 * @author zoumingyu
 * @date 2019年8月11日
 *
 */
@Api(tags = "订单相关接口")
@RestController
@RequestMapping(value = "/order")
public class OrderApiServiceImpl extends RootApiService implements OrderApiService {
	private static final Logger logger = LoggerFactory.getLogger(OrderApiServiceImpl.class);

	@Resource
	private TokenUtil tokenUtil;

	@Resource
	private OrderBffService orderBffService;

	@Resource
	private OrderSubscribeBffService orderSubscribeBffService;

	@Resource
	private OrderExclusivelBffService orderExclusivelBffService;

	@Resource
	private OrderDealerBffService orderDealerBffService;

	@Resource
	private OrderScheduleBffService orderScheduleBffService;

	@Resource
	private OrderDownloadBffService orderDownloadBffService;

	@Resource
	private OrderRenegeBffService orderRenegeBffService;

	@Resource
	private OrderLawsuitBffService orderLawsuitBffService;

	@Resource
	private ContractBffService contractBffService;

	@Resource
	private EscrowLogBffService escrowLogBffService;

	@Resource
	private CarsMileageMonitoringService monitoringService;

	@Override
	@ApiOperation(value = "获取经销商订单列表")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderType", value = "订单类型", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "dealerName", value = "经销商名称", required = false, dataType = "String"),
			@ApiImplicitParam(name = "startTime", value = "开始时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "endTime", value = "结束时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer")

	})
	@GetMapping(value = "/dealer/purchase/list")
	public ResponseResult<Paged<OrderDealerVo>> orderDealerList(@RequestParam Map<String, Object> params,
			@RequestParam Integer pageNum, @RequestParam Integer pageSize) {

		ResponseResult<Paged<OrderDealerVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderDealerList(params, pageNum, pageSize));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderDealerList]获取经销商订单列表异常", e);
			result.error("获取经销商订单列表异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取采购单信息详情 - 状态流转")
	@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long")
	@GetMapping(value = "/dealer/purchase/state/detail")
	public ResponseResult<List<OrderDealerDetailStatusVo>> getDealerOrderFlow(@RequestParam Long orderCode) {
		ResponseResult<List<OrderDealerDetailStatusVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.getDealerOrderFlow(orderCode));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[getDealerOrderFlow]获取采购单信息详情 - 状态流转异常", e);
			result.error("获取采购单信息详情 - 状态流转异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取采购单信息详情 - 基础信息")
	@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long")
	@GetMapping(value = "/dealer/purchase/basics/detail")
	public ResponseResult<OrderDealerDetailBasicVo> orderDetailBasic(@RequestParam Long orderCode) {

		ResponseResult<OrderDealerDetailBasicVo> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderDetailBasic(orderCode));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderDetailBasic]获取采购单信息详情 - 基础信息异常", e);
			result.error("获取采购单信息详情 - 基础信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取采购单信息详情 - 采购车辆列表")
	@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long")
	@GetMapping(value = "/dealer/purchase/vehicle/detail")
	public ResponseResult<OrderDealerDetailVehicleVo> orderDetailVehicle(@RequestParam Long orderCode) {
		ResponseResult<OrderDealerDetailVehicleVo> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderDetailVehicle(orderCode));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderDetailVehicle]获取采购单信息详情 - 采购车辆列表异常", e);
			result.error("获取采购单信息详情 - 采购车辆列表异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取采购单信息详情 -获取还款信息列表")
	@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long")
	@GetMapping(value = "/dealer/purchase/repayment/detail")
	public ResponseResult<List<OrderDealerDetailScheduleVo>> orderSchedule(@RequestParam Long orderCode) {
		ResponseResult<List<OrderDealerDetailScheduleVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderSchedule(orderCode));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderSchedule]获取采购单信息详情 -获取还款信息列表异常", e);
			result.error("获取采购单信息详情 -获取还款信息列表异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取发车收车列表")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "carStatus", value = "车辆状态", required = true, dataType = "Integer") })
	@GetMapping(value = "/dealer/dispatcher/list")
	public ResponseResult<Paged<OrderDealerDetailStartVo>> orderDealerStartList(@RequestParam Long orderCode,
			@RequestParam Integer carStatus) {
		ResponseResult<Paged<OrderDealerDetailStartVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderDealerStartList(orderCode, carStatus));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderDealerStartList]获取发车收车列表异常", e);
			result.error("获取发车收车列表异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "编辑发车")
	@PostMapping(value = "/dealer/dispatcher/send/modify")
	@OptionalLogConfig(methods = "经销商订单编辑发车")
	public ResponseResult<Boolean> orderDealerSendCar(
			@RequestBody OrderDealerDispatcherModifyVo orderDealerDispatcherModifyVo) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderDealerSendCar(orderDealerDispatcherModifyVo));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderDealerSendCar]编辑发车异常", e);
			result.error("编辑发车异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "车辆拒收")
	@ApiImplicitParams({@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "carId", value = "车辆id", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "rejectReason", value = "拒收原因", required = true, dataType = "String")})
	@GetMapping(value = "/dealer/dispatcher/refused/modify")
	@OptionalLogConfig(methods = "经销商订单车辆拒收")
	public ResponseResult<Boolean> orderDealerCarRefuse(@RequestParam Long orderCode, @RequestParam Integer carId,
			@RequestParam String rejectReason) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderDealerCarRefuse(orderCode, carId, rejectReason));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderDealerCarRefuse]车辆拒收异常", e);
			result.error("车辆拒收异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "更换车架号")
	@PostMapping(value = "/dealer/dispatcher/vin/modify")
	@OptionalLogConfig(methods = "经销商订单更换车架号")
	public ResponseResult<Boolean> orderDealerCarChange(
			@RequestBody OrderDealerCarChangeVinModifyVo orderDealerCarChangeVinModifyVo) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderDealerCarChange(orderDealerCarChangeVinModifyVo));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderDealerCarChange]更换车架号异常", e);
			result.error("更换车架号异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "保存交车单")
	@PostMapping(value = "/dealer/dispatcher/upload/modify")
	@OptionalLogConfig(methods = "经销商订单保存交车单")
	public ResponseResult<Boolean> modifyDeliverySlip(
			@RequestBody OrderDeliverySlipModifyVo orderDeliverySlipModifyVo) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.modifyDeliverySlip(orderDeliverySlipModifyVo));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[modifyDeliverySlip]保存交车单异常", e);
			result.error("保存交车单异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "经销商名称模糊查询")
	@ApiImplicitParam(name = "name", value = "名称", required = true, dataType = "String")
	@GetMapping(value = "/dealer/dealer")
	public ResponseResult<List<OrderFuzzyQueryVo>> getDealerListByName(@RequestParam String name) {
		ResponseResult<List<OrderFuzzyQueryVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.getDealerListByName(name));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[getDealerListByName]经销商名称模糊查询异常", e);
			result.error("经销商名称模糊查询异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "查询存在未还款的订单的经销商模糊查询")
	@ApiImplicitParam(name = "name", value = "名称", required = true, dataType = "String")
	@GetMapping(value = "/dealer/repayment/vague")
	public ResponseResult<List<OrderFuzzyQueryVo>> getDealerRepaymentListByName(@RequestParam String name) {
		ResponseResult<List<OrderFuzzyQueryVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.getDealerRepaymentListByName(name));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[getDealerListByName]查询存在未还款的订单的经销商模糊查询异常", e);
			result.error("查询存在未还款的订单的经销商模糊查询异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "分子公司名称模糊查询")
	@ApiImplicitParam(name = "name", value = "名称", required = true, dataType = "String")
	@GetMapping(value = "/dealer/subcompany")
	public ResponseResult<List<OrderFuzzyQueryVo>> getSubcompanyByName(@RequestParam String name) {
		ResponseResult<List<OrderFuzzyQueryVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.getSubcompanyByName(name));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[getSubcompanyByName]分子公司名称模糊查询异常", e);
			result.error("分子公司名称模糊查询异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "新增采购单")
	@PostMapping(value = "/dealer/purchase/create")
	@OptionalLogConfig(methods = "经销商订单新增采购单")
	public ResponseResult<Boolean> orderDealerCreate(@RequestBody OrderDealerCreateVo orderDealerCreateVo) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderDealerCreate(orderDealerCreateVo));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderDealerCreate]新增采购单异常", e);
			result.error("新增采购单异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "合同编号验重")
	@ApiImplicitParam(name = "contractCode", value = "合同编号", required = true, dataType = "String")
	@GetMapping(value = "/dealer/purchase/flow/get")
	public ResponseResult<Boolean> contractCodeRepeat(@RequestParam String contractCode) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.contractCodeRepeat(contractCode));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[contractCodeRepeat]合同编号验重异常", e);
			result.error("合同编号验重异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "新增采购单-获取车辆信息")
	@ApiImplicitParams({ @ApiImplicitParam(name = "vehicleId", value = "车型id", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "vin", value = "车架号", required = true, dataType = "String") })
	@GetMapping(value = "/dealer/purchase/detail")
	public ResponseResult<OrderDealerCarInfoVo> carInfoRepeat(@RequestParam Integer vehicleId,
			@RequestParam String vin) {
		ResponseResult<OrderDealerCarInfoVo> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.carInfoRepeat(vehicleId, vin));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[carInfoRepeat]新增采购单-获取车辆信息异常", e);
			result.error("新增采购单-获取车辆信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取经销商订单本期还款列表 - 还款计划")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "dealerName", value = "经销商名称", required = false, dataType = "String"),
			@ApiImplicitParam(name = "payableDate", value = "应还款日", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer")

	})
	@GetMapping(value = "/repayment/current/list")
	public ResponseResult<Paged<OrderScheduleCurrentPeriodVo>> getOrderScheduleCurrentPeriodList(
			@RequestParam Map<String, Object> params, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
		ResponseResult<Paged<OrderScheduleCurrentPeriodVo>> result = new ResponseResult<>();
		try {
			result.success(orderScheduleBffService.getOrderScheduleCurrentPeriodList(params, pageNum, pageSize));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[getOrderScheduleCurrentPeriodList]获取经销商订单本期还款列表 - 还款计划异常", e);
			result.error("获取经销商订单本期还款列表 - 还款计划异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取经销商订单逾期未还款列表 - 逾期未还款")
	@ApiImplicitParams({@ApiImplicitParam(name = "orderCode", value = "订单号", dataType = "Long"),
			@ApiImplicitParam(name = "dealerName", value = "经销商名称", dataType = "String"),
			@ApiImplicitParam(name = "payableDate", value = "应还款日", dataType = "Integer"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer")

	})
	@GetMapping(value = "/repayment/overdue/list")
	public ResponseResult<Paged<OrderScheduleOverdueVo>> getOrderScheduleOverdueList(
			@RequestParam Map<String, Object> params, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
		ResponseResult<Paged<OrderScheduleOverdueVo>> result = new ResponseResult<>();
		try {
			result.success(orderScheduleBffService.getOrderScheduleOverdueList(params, pageNum, pageSize));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[getOrderScheduleOverdueList]获取经销商订单逾期未还款列表 - 逾期未还款异常", e);
			result.error("获取经销商订单逾期未还款列表 - 逾期未还款异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取还款信息详情 - 基础信息")
	@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long")
	@GetMapping(value = "/dealer/repayment/basics/detail")
	public ResponseResult<OrderDealerDetailBasicInfoVo> getDetailBasic(@RequestParam Long orderCode) {
		ResponseResult<OrderDealerDetailBasicInfoVo> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.getDetailBasic(orderCode));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[getDetailBasic]获取还款信息详情 - 基础信息异常", e);
			result.error("获取还款信息详情 - 基础信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取还款计划详情-还款计划信息")
	@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long")
	@GetMapping(value = "/dealer/repayment/plan/detail")
	public ResponseResult<List<OrderDealerDetailScheduleVo>> orderSchedulePlan(@RequestParam Long orderCode) {
		ResponseResult<List<OrderDealerDetailScheduleVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderSchedulePlan(orderCode));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderSchedulePlan]获取还款计划详情-还款计划信息异常", e);
			result.error("获取还款计划详情-还款计划信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "获取还款信息详情 - 逾期信息")
	@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long")
	@GetMapping(value = "/dealer/repayment/expire/detail")
	public ResponseResult<List<OrderDealerDetailScheduleVo>> orderScheduleExpire(@RequestParam Long orderCode) {
		ResponseResult<List<OrderDealerDetailScheduleVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.orderScheduleExpire(orderCode));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderScheduleExpire]获取还款信息详情 - 逾期信息异常", e);
			result.error("获取还款信息详情 - 逾期信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "订阅里程订单列表信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，credit：征信审核，return：还车列表)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderStatus", value = "订单状态", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "userName", value = "用户账号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "storeId", value = "下单门店id", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "orderTimeStart", value = "下单开始时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "orderTimeEnd", value = "下单结束时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "isHaveSuborder", value = "有无续订(0：无，1：有)", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "getSource", value = "查询来源(1：首页)", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "refundStatus", value = "退款状态(15：待处理，16：退款中，17：已退款)", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "vin", value = "车架号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "licencePlate", value = "车牌号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer")})
	@GetMapping(value = "/subscribe/{listType}/list")
	public ResponseResult<Paged<OrderSubscribeVo>> orderSubscribeList(@PathVariable("listType") String listType,
			@RequestParam Map<String, Object> selectParams) {
		ResponseResult<Paged<OrderSubscribeVo>> result = new ResponseResult<>();
		try {
			// 转换参数
			if (listType.equals("trade")) {
				// 交易列表
				selectParams.put("listType", OrderListTypeEnum.TRADE_LIST);
			} else if (listType.equals("credit")) {
				// 征信审核
				selectParams.put("listType", OrderListTypeEnum.CREDIT_LIST);
				Integer refundStatus = ObjectCastUtil.castInteger(selectParams.get("refundStatus"));
				if (refundStatus != null) {
					selectParams.put("refundStatus", OrderSubscribeStatusEnum.getEnum(refundStatus));
				}
			} else if (listType.equals("return")) {
				// 到期还车
				selectParams.put("listType", OrderListTypeEnum.RETURN_LIST);
			} else {
				return result.error(ResponseCodeEnum.PARMS_ERROR.getCode(), "列表类型错误");
			}
			Integer orderStatus = ObjectCastUtil.castInteger(selectParams.get("orderStatus"));
			if (orderStatus != null) {
				selectParams.put("orderStatus", OrderSubscribeStatusEnum.getEnum(orderStatus));
			}

			Paged<OrderSubscribeVo> data = orderSubscribeBffService.getOrderList(selectParams,
					ObjectCastUtil.castInteger(selectParams.get("pageNum"), 1),
					ObjectCastUtil.castInteger(selectParams.get("pageSize"), 10));

			result.success(data);
		} catch (BizException e) {
			logger.error("[orderSubscribeList]查询订阅里程订单列表信息异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderSubscribeList]查询订阅里程订单列表信息异常:", e);
			result.error("查询订阅里程订单列表信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "订阅里程订单交易流程")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，return：还车列表)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/subscribe/{listType}/flow")
	public ResponseResult<List<OrderTradeFlowVo>> orderSubscribeFlow(@PathVariable("listType") String listType,
			Long orderCode) {
		ResponseResult<List<OrderTradeFlowVo>> result = new ResponseResult<>();
		try {
			List<OrderTradeFlowVo> data = null;
			if (listType.equals("trade")) {
				data = orderSubscribeBffService.getOrderTradeFlow(orderCode, OrderListTypeEnum.TRADE_LIST);
			} else if (listType.equals("return")) {
				data = orderSubscribeBffService.getOrderTradeFlow(orderCode, OrderListTypeEnum.RETURN_LIST);
			} else {
				return result.error(ResponseCodeEnum.PARMS_ERROR.getCode(), "列表类型错误");
			}

			result.success(data);
		} catch (BizException e) {
			logger.error("[orderSubscribeFlow]查询订阅里程订单交易流程异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderSubscribeFlow]查询订阅里程订单交易流程异常:", e);
			result.error("查询订阅里程订单交易流程异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "订阅里程订单基础信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，return：还车列表)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/subscribe/{listType}/base")
	public ResponseResult<List<OrderSubscribeBaseVo>> orderSubscribeBase(@PathVariable("listType") String listType,
			Long orderCode) {
		ResponseResult<List<OrderSubscribeBaseVo>> result = new ResponseResult<>();
		try {
			List<OrderSubscribeBaseVo> data = orderSubscribeBffService.getOrderBaseList(orderCode, null);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderSubscribeDetails]查询订阅里程订单详情异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderSubscribeDetails]查询订阅里程订单详情异常:", e);
			result.error("查询订阅里程订单详情异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "订阅里程订单服务明细")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/subscribe/service/details")
	public ResponseResult<OrderUsedCarVo> orderSubscribeServiceDetails(@RequestParam Long orderCode) {
		ResponseResult<OrderUsedCarVo> result = new ResponseResult<>();
		try {
			OrderUsedCarVo data = orderSubscribeBffService.getOrderUsedCar(orderCode);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderSubscribeServiceDetails]查询订阅里程订单用车实况异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderSubscribeServiceDetails]查询订阅里程订单用车实况异常:", e);
			result.error("查询订阅里程订单用车实况异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "订阅里程订单用车实况")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/subscribe/used/car")
	public ResponseResult<OrderUsedCarVo> orderSubscribeUsedCar(@RequestParam Long orderCode) {
		ResponseResult<OrderUsedCarVo> result = new ResponseResult<>();
		try {
			OrderUsedCarVo data = orderSubscribeBffService.getOrderUsedCar(orderCode);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderSubscribeUsedCar]查询订阅里程订单用车实况异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderSubscribeUsedCar]查询订阅里程订单用车实况异常:", e);
			result.error("查询订阅里程订单用车实况异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "订单用车实况")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，return：还车列表)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/subscribe/{listType}/used/car")
	public ResponseResult<OrderUsedCarVo> orderUsedCar(@PathVariable("listType") String listType,
			@RequestParam Long orderCode) {
		ResponseResult<OrderUsedCarVo> result = new ResponseResult<>();
		try {
			OrderUsedCarVo data = orderSubscribeBffService.getOrderUsedCar(orderCode);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderUsedCar]查询订单用车实况异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderUsedCar]查询订单用车实况异常:", e);
			result.error("查询订单用车实况异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "订阅里程订单费用交易明细")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，return：还车列表)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/subscribe/{listType}/cost/detail")
	public ResponseResult<List<OrderCostDetailsVo>> orderSubscribeCostDetails(@PathVariable("listType") String listType,
			Long orderCode) {
		ResponseResult<List<OrderCostDetailsVo>> result = new ResponseResult<>();
		try {
			List<OrderCostDetailsVo> data = orderSubscribeBffService.getOrderCostDetails(orderCode);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderSubscribeCostDetails]查询订阅里程订单费用交易明细:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderSubscribeCostDetails]查询订阅里程订单费用交易明细:", e);
			result.error("查询订阅里程订单费用交易明细");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属里程订单列表信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，credit：征信审核，renege：退租订单)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderStatus", value = "订单状态", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "userName", value = "用户账号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "storeId", value = "下单门店id", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "orderTimeStart", value = "下单开始时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "orderTimeEnd", value = "下单结束时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "renegeTimeStart", value = "退租开始时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "renegeTimeEnd", value = "退租结束时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "getSource", value = "查询来源(1：首页)", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "refundStatus", value = "退款状态(15：待处理，16：退款中，17：已退款)", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "vin", value = "车架号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "licencePlate", value = "车牌号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer")})
	@GetMapping(value = "/exclusivel/{listType}/list")
	public ResponseResult<Paged<OrderExclusivelVo>> orderExclusivelList(@PathVariable("listType") String listType,
			@RequestParam Map<String, Object> selectParams) {
		ResponseResult<Paged<OrderExclusivelVo>> result = new ResponseResult<>();
		try {
			// 转换参数
			if (listType.equals("trade")) {
				// 交易列表
				selectParams.put("listType", OrderListTypeEnum.TRADE_LIST);
			} else if (listType.equals("credit")) {
				// 征信审核
				selectParams.put("listType", OrderListTypeEnum.CREDIT_LIST);
				Integer refundStatus = ObjectCastUtil.castInteger(selectParams.get("refundStatus"));
				if (refundStatus != null) {
					selectParams.put("refundStatus", OrderSubscribeStatusEnum.getEnum(refundStatus));
				}
			} else if (listType.equals("renege")) {
				// 退租订单
				selectParams.put("listType", OrderListTypeEnum.RENEGE_LIST);
			} else {
				return result.error(ResponseCodeEnum.PARMS_ERROR.getCode(), "列表类型错误");
			}
			Integer orderStatus = ObjectCastUtil.castInteger(selectParams.get("orderStatus"));
			if (orderStatus != null) {
				selectParams.put("orderStatus", OrderExclusivelStatusEnum.getEnum(orderStatus));
			}

			Paged<OrderExclusivelVo> data = orderExclusivelBffService.getOrderList(selectParams,
					ObjectCastUtil.castInteger(selectParams.get("pageNum"), 1),
					ObjectCastUtil.castInteger(selectParams.get("pageSize"), 10));

			result.success(data);
		} catch (BizException e) {
			logger.error("[orderExclusivelList]查询专属里程订单列表信息异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderExclusivelList]查询专属里程订单列表信息异常:", e);
			result.error("查询专属里程订单列表信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "专属里程订单交易流程")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，return：还车列表)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/exclusivel/{listType}/flow")
	public ResponseResult<List<OrderTradeFlowVo>> orderExclusivelFlow(@PathVariable("listType") String listType,
			Long orderCode) {
		ResponseResult<List<OrderTradeFlowVo>> result = new ResponseResult<>();
		try {
			List<OrderTradeFlowVo> data = null;
			if (listType.equals("trade")) {
				data = orderExclusivelBffService.getOrderTradeFlow(orderCode, OrderListTypeEnum.TRADE_LIST);
			} else if (listType.equals("return")) {
				data = orderExclusivelBffService.getOrderTradeFlow(orderCode, OrderListTypeEnum.RETURN_LIST);
			} else {
				return result.error(ResponseCodeEnum.PARMS_ERROR.getCode(), "列表类型错误");
			}

			result.success(data);
		} catch (BizException e) {
			logger.error("[orderExclusivelFlow]查询专属里程订单交易流程异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderExclusivelFlow]查询专属里程订单交易流程异常:", e);
			result.error("查询专属里程订单交易流程异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属里程订单基础信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，return：还车列表)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/exclusivel/{listType}/base")
	public ResponseResult<OrderExclusivelBaseVo> orderExclusivelBase(@PathVariable("listType") String listType,
			Long orderCode) {
		ResponseResult<OrderExclusivelBaseVo> result = new ResponseResult<>();
		try {
			OrderExclusivelBaseVo data = orderExclusivelBffService.getOrderBase(orderCode);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderExclusivelBase]查询专属里程订单详情异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderExclusivelBase]查询专属里程订单详情异常:", e);
			result.error("查询专属里程订单详情异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属里程订单费用交易明细")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，return：还车列表)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/exclusivel/{listType}/cost/detail")
	public ResponseResult<List<OrderCostDetailsVo>> orderExclusivelCostDetails(
			@PathVariable("listType") String listType, Long orderCode) {
		ResponseResult<List<OrderCostDetailsVo>> result = new ResponseResult<>();
		try {
			List<OrderCostDetailsVo> data = orderExclusivelBffService.getOrderCostDetails(orderCode);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderExclusivelCostDetails]查询专属里程订单费用交易明细异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderExclusivelCostDetails]查询专属里程订单费用交易明细异常:", e);
			result.error("查询专属里程订单费用交易明细异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属里程订单还款明细")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "listType", value = "列表类型(trade：交易列表，return：还车列表)", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long") })
	@GetMapping(value = "/exclusivel/{listType}/repayment/detail")
	public ResponseResult<OrderExclusivelRepaymentDetailVo> orderExclusivelRepaymentDetail(
			@PathVariable("listType") String listType, Long orderCode) {
		ResponseResult<OrderExclusivelRepaymentDetailVo> result = new ResponseResult<>();
		try {
			OrderExclusivelRepaymentDetailVo data = orderExclusivelBffService
					.getOrderExclusivelRepaymentDetail(orderCode);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderExclusivelCostDetails]查询专属里程订单还款明细异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderExclusivelCostDetails]查询专属里程订单还款明细异常:", e);
			result.error("查询专属里程订单还款明细异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属里程订单本期还款计划列表")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "payableDate", value = "应还款日", required = false, dataType = "String"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer") })
	@GetMapping(value = "/exclusivel/current/list")
	public ResponseResult<Paged<OrderRepaymentVo>> orderExclusivelCurrentPeriod(
			@RequestParam Map<String, Object> selectParams) {
		ResponseResult<Paged<OrderRepaymentVo>> result = new ResponseResult<>();
		try {
			Paged<OrderRepaymentVo> data = orderScheduleBffService.getExclusivelOrderCurrentPeriod(selectParams,
					ObjectCastUtil.castInteger(selectParams.get("pageNum"), 1),
					ObjectCastUtil.castInteger(selectParams.get("pageSize"), 10));
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderExclusivelCurrentPeriod]查询专属里程订单本期还款计划列表异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderExclusivelCurrentPeriod]查询专属里程订单本期还款计划列表异常:", e);
			result.error("查询专属里程订单本期还款计划列表异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属里程本期还款计划导出")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCodes", value = "订单号list(选择导出使用)", required = false, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "payableDate", value = "应还款日", required = false, dataType = "String") })
	@GetMapping(value = "/download/exclusivel/current/list")
	public void orderExclusivelCurrentPeriodDownload(HttpServletRequest request, HttpServletResponse response,
			@RequestParam Map<String, Object> selectParams) {
		try {
			if (selectParams == null) {
				selectParams = new HashMap<>();
			}
			List<OrderRepaymentVo> datas = orderDownloadBffService
					.getOrderExclusivelCurrentPeriodDownload(selectParams);

			String fileName = "专属订单还款计划(" + DateUtil.formatDate(LocalDate.now()) + ").xlsx";

			// 生成excel
			XSSFWorkbook xssBook = PoiExcelUtil.repaymentSchedule(datas);
			// 下载
			DownloadFileUtil.downloadExcel(request, response, fileName, xssBook);
		} catch (BizException e) {
			logger.error("[orderExclusivelCurrentPeriodDownload]专属里程本期还款计划导出异常:", e);
		} catch (Exception e) {
			logger.error("[orderExclusivelCurrentPeriodDownload]专属里程本期还款计划导出异常:", e);
		}
	}

	@Override
	@ApiOperation(value = "专属里程本期还款计划导出查询")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCodes", value = "订单号list(选择导出使用)", required = false, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "payableDate", value = "应还款日", required = false, dataType = "String") })
	@GetMapping(value = "/download/exclusivel/current/list/query")
	public ResponseResult<Boolean> orderExclusivelCurrentPeriodDownloadQuery(HttpServletRequest request,
			HttpServletResponse response, @RequestParam Map<String, Object> selectParams) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			if (selectParams == null) {
				selectParams = new HashMap<>();
			}

			// 查询导出条数
			Long total = orderDownloadBffService.getOrderExclusivelCurrentPeriodDownloadCount(selectParams);
			if (total != null && total > ContantsUtil.DOWNLOAD_EXCEL_MAX_NUM) {
				// 大于最大导出条数，异步发邮件
				orderDownloadBffService.getOrderExclusivelCurrentPeriodDownloadEmail(selectParams, tokenUtil.getUser());
				// 返回提示
				result.success("已将导出数据发送至您的邮箱", true);
			} else {
				// 小于最大导出条数，提示前端调用直接导出接口
				result.success(false);
			}
		} catch (BizException e) {
			logger.error("[orderExclusivelCurrentPeriodDownloadQuery]专属里程本期还款计划导出异常:", e);
			result.error("专属里程本期还款计划导出异常");
		} catch (Exception e) {
			logger.error("[orderExclusivelCurrentPeriodDownloadQuery]专属里程本期还款计划导出异常:", e);
			result.error("专属里程本期还款计划导出异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属里程订单逾期列表")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "payableDate", value = "应还款日", required = false, dataType = "String"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer") })
	@GetMapping(value = "/exclusivel/overdue/list")
	public ResponseResult<Paged<OrderOverdueVo>> orderExclusivelOverdue(
			@RequestParam Map<String, Object> selectParams) {
		ResponseResult<Paged<OrderOverdueVo>> result = new ResponseResult<>();
		try {
			Paged<OrderOverdueVo> data = orderScheduleBffService.getExclusivelOrderOverdue(selectParams,
					ObjectCastUtil.castInteger(selectParams.get("pageNum"), 1),
					ObjectCastUtil.castInteger(selectParams.get("pageSize"), 10));
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderExclusivelOverdue]查询专属里程订单逾期列表异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderExclusivelOverdue]查询专属里程订单逾期列表异常:", e);
			result.error("查询专属里程订单逾期列表异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属里程订单逾期导出")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCodes", value = "订单号list(选择导出使用)", required = false, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "payableDate", value = "应还款日", required = false, dataType = "String") })
	@GetMapping(value = "/download/exclusivel/overdue/list")
	public void orderExclusivelOverdueDownload(HttpServletRequest request, HttpServletResponse response,
			@RequestParam Map<String, Object> selectParams) {
		try {
			if (selectParams == null) {
				selectParams = new HashMap<>();
			}
			List<OrderOverdueVo> datas = orderDownloadBffService.getExclusivelOrderOverdueDownload(selectParams);

			String fileName = "专属订单逾期未还排期(" + DateUtil.formatDate(LocalDate.now()) + ").xlsx";
			// 生成excel
			XSSFWorkbook xssBook = PoiExcelUtil.overdueSchedule(datas);
			// 下载
			DownloadFileUtil.downloadExcel(request, response, fileName, xssBook);
		} catch (BizException e) {
			logger.error("[orderExclusivelOverdueDownload]专属里程订单逾期列表导出异常:", e);
		} catch (Exception e) {
			logger.error("[orderExclusivelOverdueDownload]专属里程订单逾期列表导出异常:", e);
		}
	}

	@Override
	@ApiOperation(value = "专属里程订单逾期导出")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCodes", value = "订单号list(选择导出使用)", required = false, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", required = false, dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "payableDate", value = "应还款日", required = false, dataType = "String") })
	@GetMapping(value = "/download/exclusivel/overdue/list/query")
	public ResponseResult<Boolean> orderExclusivelOverdueDownloadQuery(HttpServletRequest request,
			HttpServletResponse response, @RequestParam Map<String, Object> selectParams) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			if (selectParams == null) {
				selectParams = new HashMap<>();
			}

			// 查询导出条数
			Long total = orderDownloadBffService.getOrderExclusivelOverdueDownloadCount(selectParams);
			if (total != null && total > ContantsUtil.DOWNLOAD_EXCEL_MAX_NUM) {
				// 大于最大导出条数，异步发邮件
				orderDownloadBffService.getOrderExclusivelOverdueDownloadEmail(selectParams, tokenUtil.getUser());
				// 返回提示
				result.success("已将导出数据发送至您的邮箱", true);
			} else {
				// 小于最大导出条数，提示前端调用直接导出接口
				result.success(false);
			}
		} catch (BizException e) {
			logger.error("[orderExclusivelOverdueDownloadQuery]专属里程订单逾期导出异常:", e);
			result.error("专属里程订单逾期导出异常");
		} catch (Exception e) {
			logger.error("[orderExclusivelOverdueDownloadQuery]专属里程订单逾期导出异常:", e);
			result.error("专属里程订单逾期导出异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属里程订单还款排期列表")
	@ApiImplicitParams({@ApiImplicitParam(name = "orderCode", value = "订单号", required = false, dataType = "Long"),
			@ApiImplicitParam(name = "overdue", value = "是否只查询逾期", required = false, dataType = "Integer（0：否，1：是）")})
	@GetMapping(value = "/exclusivel/repayment/list")
	public ResponseResult<List<OrderRepaymentDetailVo>> orderRepaymentDetail(Long orderCode, Integer overdue) {
		ResponseResult<List<OrderRepaymentDetailVo>> result = new ResponseResult<>();
		try {
			List<OrderRepaymentDetailVo> data = orderScheduleBffService.getRepaymentDetail(orderCode,
					overdue == null ? false : overdue == 1 ? true : false);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderRepaymentDetail]查询专属里程订单还款排期列表异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderRepaymentDetail]查询专属里程订单还款排期列表异常:", e);
			result.error("查询专属里程订单还款排期列表异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "根据用户id获取订单信息")
	@ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户id", required = true, dataType = "Integer") })
	@GetMapping(value = "/list/user")
	public ResponseResult<List<UserOrderVo>> orderByUser(Integer userId) {
		ResponseResult<List<UserOrderVo>> result = new ResponseResult<>();
		try {
			List<UserOrderVo> data = orderBffService.getOrderByUser(userId);
			result.success(data == null ? new ArrayList<>() : data);
		} catch (BizException e) {
			logger.error("[orderByUser]根据用户id(" + userId + ")查询订单信息异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderByUser]根据用户id(" + userId + ")查询订单信息异常:", e);
			result.error("查询订单信息异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "根据车辆id获取订单信息")
	@ApiImplicitParams({ @ApiImplicitParam(name = "carId", value = "车辆id", required = true, dataType = "Integer") })
	@GetMapping(value = "/list/car")
	public ResponseResult<List<CarOrderVo>> orderByCar(Integer carId) {
		ResponseResult<List<CarOrderVo>> result = new ResponseResult<>();
		try {
			List<CarOrderVo> data = orderBffService.getOrderByCar(carId);
			result.success(data);
		} catch (BizException e) {
			logger.error("[orderByCar]根据车辆id(" + carId + ")查询订单信息异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderByCar]根据车辆id(" + carId + ")查询订单信息异常:", e);
			result.error("查询订单信息异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "订单线下支付列表")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "repayType", value = "还款类型(dealer:经销商, user:用户) ", required = true, dataType = "String"),
			@ApiImplicitParam(name = "serialNumber", value = "流水编号", required = false, dataType = "String"),
			@ApiImplicitParam(name = "auditStatus", value = "审核状态", required = false, dataType = "Integer"),
			@ApiImplicitParam(name = "dealerName", value = "经销商名称", required = false, dataType = "String"),
			@ApiImplicitParam(name = "payName", value = "付款方姓名", required = false, dataType = "String"),
			@ApiImplicitParam(name = "startApplyTime", value = "开始时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "endApplyTime", value = "结束时间", required = false, dataType = "String"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer") })
	@GetMapping(value = "/payment/offline/{repayType}/list")
	public ResponseResult<Paged<PaymentOfflineVo>> orderPaymentOfflineList(@PathVariable("repayType") String repayType,
			@RequestParam Map<String, Object> selectParams) {
		ResponseResult<Paged<PaymentOfflineVo>> result = new ResponseResult<>();
		try {
			if ("dealer".equals(repayType)) {
				// 经销商
				selectParams.put("repayType", OfflineRepayTypeEnum.DEALER);
			} else if ("user".equals(repayType)) {
				// 用户
				selectParams.put("repayType", OfflineRepayTypeEnum.USER);
			} else {
				return result.error("查询列表信息异常，不存在的还款类型");
			}

			result.success(orderScheduleBffService.getPaymentOfflinePage(selectParams,
					ObjectCastUtil.castInteger(selectParams.get("pageNum"), 1),
					ObjectCastUtil.castInteger(selectParams.get("pageSize"), 10)));
		} catch (IllegalArgumentException e) {
			logger.error("[orderPaymentOfflineList]查询订单线下支付列表异常:", e);
			result.error(e.getMessage());
		} catch (BizException e) {
			logger.error("[orderPaymentOfflineList]查询订单线下支付列表异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderPaymentOfflineList]查询订单线下支付列表异常", e);
			result.error("查询列表信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "订单线下支付流水信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "offlineId", value = "线下支付id", required = true, dataType = "Integer") })
	@GetMapping(value = "/payment/offline/flow")
	public ResponseResult<PaymentOfflineVo> orderPaymentOfflineFlow(Integer offlineId) {
		ResponseResult<PaymentOfflineVo> result = new ResponseResult<>();
		try {
			result.success(orderScheduleBffService.getPaymentOfflineFlow(offlineId));
		} catch (IllegalArgumentException e) {
			logger.error("[orderPaymentOfflineFlow]根据线下支付id(" + offlineId + ")获取订单线下支付流水信息异常:", e);
			result.error(e.getMessage());
		} catch (BizException e) {
			logger.error("[orderPaymentOfflineFlow]根据线下支付id(" + offlineId + ")获取订单线下支付流水信息异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderPaymentOfflineFlow]根据线下支付id(" + offlineId + ")获取订单线下支付流水信息异常", e);
			result.error("查询订单线下支付流水信息异常:");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "订单线下支付排期信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "repayType", value = "还款类型(dealer:经销商, user:用户) ", required = true, dataType = "String"),
			@ApiImplicitParam(name = "offlineId", value = "线下支付id", required = true, dataType = "Integer") })
	@GetMapping(value = "/payment/offline/{repayType}/schedule/list")
	public ResponseResult<List<PaymentOfflineScheduleVo>> orderPaymentOfflineSchedule(
			@PathVariable("repayType") String repayType, Integer offlineId) {
		ResponseResult<List<PaymentOfflineScheduleVo>> result = new ResponseResult<>();
		try {
			OfflineRepayTypeEnum repayTypeEnum = null;
			if ("dealer".equals(repayType)) {
				// 经销商
				repayTypeEnum = OfflineRepayTypeEnum.DEALER;
			} else if ("user".equals(repayType)) {
				// 用户
				repayTypeEnum = OfflineRepayTypeEnum.USER;
			} else {
				return result.error("查询订单线下支付排期信息异常，不存在的还款类型");
			}

			result.success(orderScheduleBffService.getPaymentOfflineSchedule(offlineId, repayTypeEnum));
		} catch (IllegalArgumentException e) {
			logger.error("[orderPaymentOfflineSchedule]根据线下支付id(" + offlineId + ")获取订单线下支付排期信息异常:", e);
			result.error(e.getMessage());
		} catch (BizException e) {
			logger.error("[orderPaymentOfflineSchedule]根据线下支付id(" + offlineId + ")获取订单线下支付排期信息异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderPaymentOfflineSchedule]根据线下支付id(" + offlineId + ")获取订单线下支付排期信息异常:", e);
			result.error("查询订单线下支付排期信息异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "订单线下支付审核信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "offlineId", value = "线下支付id", required = true, dataType = "Integer") })
	@GetMapping(value = "/payment/offline/audit")
	public ResponseResult<PaymentOfflineAuditVo> orderPaymentOfflineAudit(Integer offlineId) {
		ResponseResult<PaymentOfflineAuditVo> result = new ResponseResult<>();
		try {
			result.success(orderScheduleBffService.getPaymentOfflineAudit(offlineId));
		} catch (IllegalArgumentException e) {
			logger.error("[orderPaymentOfflineAudit]根据线下支付id(" + offlineId + ")查询订单线下支付审核信息异常:", e);
			result.error(e.getMessage());
		} catch (BizException e) {
			logger.error("[orderPaymentOfflineAudit]根据线下支付id(" + offlineId + ")查询订单线下支付审核信息异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderPaymentOfflineAudit]根据线下支付id(" + offlineId + ")查询订单线下支付审核信息异常", e);
			result.error("查询订单线下支付审核信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "订单线下支付流水编号是否存在")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "serialNumber", value = "流水编号", required = true, dataType = "String") })
	@GetMapping(value = "/payment/offline/serialNumber/exists")
	public ResponseResult<Boolean> orderPaymentOfflineSerialNumberExists(String serialNumber) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderScheduleBffService.getSerialNumberExists(serialNumber));
		} catch (IllegalArgumentException e) {
			result.error(ResponseCodeEnum.PARMS_ERROR.getCode(), e.getMessage());
		} catch (BizException e) {
			logger.error("[orderPaymentOfflineSerialNumberExists]查询订单线下支付流水编号(" + serialNumber + ")是否存在异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[orderPaymentOfflineSerialNumberExists]查询订单线下支付流水编号(" + serialNumber + ")是否存在异常", e);
			result.error("查询订单线下支付流水编号是否存在异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "经销商订单所有未还款订单")
	@ApiImplicitParam(name = "dealerId", value = "线下支付单id", required = true, dataType = "Integer")
	@GetMapping(value = "/dealer/wait/repay/list")
	public ResponseResult<List<OrderScheduleUnpaidVo>> getOrderScheduleUnpaid(Integer dealerId) {
		ResponseResult<List<OrderScheduleUnpaidVo>> result = new ResponseResult<>();
		try {
			result.success(orderDealerBffService.getOrderScheduleUnpaid(dealerId));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[getOrderScheduleUnpaid]订单线下支付获取经销商下未所有还款订单异常", e);
			result.error("获取经销商下未所有还款订单异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "经销商订单支付未还款排期")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long") })
	@GetMapping(value = "/dealer/wait/repay/schedule/list")
	public ResponseResult<List<OrderScheduleRelationVo>> orderDealerScheduleNoRepay(Long orderCode) {
		ResponseResult<List<OrderScheduleRelationVo>> result = new ResponseResult<>();
		try {
			result.success(orderScheduleBffService.getOrderScheduleRelationBizDto(orderCode));
		} catch (Exception e) {
			// 记录异常，返回异常信息
			logger.error("[getOrderScheduleRelationBizDto]订单线下经销商订单支付未还款排期异常", e);
			result.error("订单线下经销商订单支付未还款排期异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "用户订单支付未还款排期-线下还款查询排期用")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long") })
	@GetMapping(value = "/user/wait/repay/schedule/list")
	public ResponseResult<List<OrderRepaymentDetailVo>> orderUserScheduleNoRepay(String orderCode) {
		ResponseResult<List<OrderRepaymentDetailVo>> result = new ResponseResult<>();
		try {
			Long orderCode2 = null;
			try {
				orderCode2 = Long.parseLong(orderCode);
			} catch (Exception e) {
				result.success("订单编号错误", null);
			}
			List<OrderRepaymentDetailVo> rst = orderScheduleBffService.getOrderUserScheduleNoRepayOffline(orderCode2);
			if (rst == null || rst.isEmpty()) {
				result.success("无此订单或已还完", rst);
			} else {
				result.success(rst);
			}
		} catch (BizException e) {
			logger.error("[orderUserScheduleNoRepay]查询用户订单支付未还款排期异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderUserScheduleNoRepay]查询用户订单支付未还款排期异常", e);
			result.error("查询用户订单支付未还款排期异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "订单线下支付新增")
	@PostMapping(value = "/payment/offline/create")
	@OptionalLogConfig(methods = "新增订单线下支付")
	public ResponseResult<Boolean> createOrderPaymentOffline(@RequestBody @Valid PaymentOfflineCreateVo createVo,
			BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderScheduleBffService.createOrderPaymentOffline(createVo));
		} catch (IllegalArgumentException e) {
			logger.error("[createOrderPaymentOffline]订单线下支付新增异常:", e);
			result.error(e.getMessage());
		} catch (BizException e) {
			logger.error("[createOrderPaymentOffline]订单线下支付新增异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[createOrderPaymentOffline]订单线下支付新增异常", e);
			result.error("新增订单线下支付失败");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "合同/单据信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "documentType", value = "文件类型（contract：合同，sheet：取还单据）", required = true, dataType = "String"),
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long") })
	@GetMapping(value = "/document/{documentType}/list")
	public ResponseResult<List<OrderContractVo>> orderContract(@PathVariable("documentType") String documentType,
			Long orderCode) {
		ResponseResult<List<OrderContractVo>> result = new ResponseResult<>();
		DocumentTypeEnum documentTypeEnum = null;
		try {
			// 转换参数
			if ("contract".equals(documentType)) {
				documentTypeEnum = DocumentTypeEnum.CONTRACT;
			} else if ("sheet".equals(documentType)) {
				documentTypeEnum = DocumentTypeEnum.SHEET;
			} else {
				return result.error(ResponseCodeEnum.PARMS_ERROR.getCode(), "查询类型错误");
			}
			result.success(orderBffService.getOrderContract(orderCode, documentTypeEnum));
		} catch (IllegalArgumentException e) {
			logger.error("[orderContract]根据订单号(" + orderCode + ")查询" + documentTypeEnum.getName() + "信息异常:", e);
			result.error(e.getMessage());
		} catch (BizException e) {
			logger.error("[orderContract]根据订单号(" + orderCode + ")查询" + documentTypeEnum.getName() + "信息异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderContract]根据订单号(" + orderCode + ")查询" + documentTypeEnum.getName() + "信息异常", e);
			result.error("查询" + documentTypeEnum.getName() + "信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "合同单据信息")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long") })
	@GetMapping(value = "/document/list")
	public ResponseResult<List<OrderContractVo>> orderContractDocuments(@RequestParam Long orderCode) {
		ResponseResult<List<OrderContractVo>> result = new ResponseResult<>();
		DocumentTypeEnum documentTypeEnum = null;
		try {
			result.success(orderBffService.getOrderContract(orderCode, documentTypeEnum));
		} catch (IllegalArgumentException e) {
			logger.error("[orderContractDocuments]根据订单号(" + orderCode + ")查询合同单据信息异常:", e);
			result.error(e.getMessage());
		} catch (BizException e) {
			logger.error("[orderContractDocuments]根据订单号(" + orderCode + ")查询合同单据信息异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[orderContractDocuments]根据订单号(" + orderCode + ")查询合同单据信息异常", e);
			result.error("查询合同单据信息异常");
		}
		return result;
	}

	@Override
	@ApiOperation(value = "订单审核")
	@PostMapping(value = "/audit/modify")
	@OptionalLogConfig(methods = "订单审核")
	public ResponseResult<Boolean> orderAudit(@RequestBody @Valid OrderTradeAuditModifyVo modifyVo,
			BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			if (orderBffService.modifyOrderAudit(modifyVo)) {
				result.success(true);
			} else {
				result.error(ResponseCodeEnum.OPTION_ERROR.getCode(), "订单审核失败");
			}
		} catch (BizException e) {
			logger.error("[orderAudit]订单审核失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[orderAudit]订单审核异常:", e);
			result.error("订单审核异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "查询订单审核信息")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long") })
	@GetMapping(value = "/audit/info")
	public ResponseResult<OrderAuditVo> getOrderAudit(Long orderCode) {
		ResponseResult<OrderAuditVo> result = new ResponseResult<>();
		try {
			result.success(orderBffService.getOrderAudit(orderCode));
		} catch (BizException e) {
			logger.error("[getOrderAudit]查询订单审核信息失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[getOrderAudit]查询订单审核信息异常:", e);
			result.error("查询订单审核信息异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "订单交易退款")
	@PostMapping(value = "/trade/refund/modify")
	@OptionalLogConfig(methods = "订单交易退款")
	public ResponseResult<Boolean> orderTradeRefund(@RequestBody @Valid OrderTradeRefundModifyVo modifyVo,
			BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			if (orderBffService.modifyOrderTradeRefund(modifyVo)) {
				result.success(true);
			} else {
				result.error(ResponseCodeEnum.OPTION_ERROR.getCode(), "订单交易退款操作失败");
			}
		} catch (BizException e) {
			logger.error("[orderTradeRefund]订单交易退款操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[orderTradeRefund]订单交易退款操作异常:", e);
			result.error("订单退款操作异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "查询订单交易退款信息")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long") })
	@GetMapping(value = "/trade/refund/info")
	public ResponseResult<OrderTradeRefundVo> getOrderTradeRefund(Long orderCode) {
		ResponseResult<OrderTradeRefundVo> result = new ResponseResult<>();
		try {
			result.success(orderBffService.getOrderTradeRefund(orderCode));
		} catch (BizException e) {
			logger.error("[getOrderTradeRefund]查询订单交易退款信息失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[getOrderTradeRefund]查询订单交易退款信息异常:", e);
			result.error("查询订单交易退款信息异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "订单征信审核")
	@PostMapping(value = "/exclusivel/credit/audit/modify")
	@OptionalLogConfig(methods = "订单征信审核")
	public ResponseResult<Boolean> orderCreditAudit(@RequestBody @Valid OrderCreditAuditModifyVo modifyVo,
			BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderExclusivelBffService.modifyOrderCreditAudit(modifyVo));
		} catch (BizException e) {
			logger.error("[orderCreditAudit]订单征信审核操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[orderCreditAudit]订单征信审核操作异常:", e);
			result.error("订单征信审核操作异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "查询订单审核信息")
	@ApiImplicitParams({ @ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long") })
	@GetMapping(value = "/exclusivel/credit/audit/info")
	public ResponseResult<OrderAuditVo> getOrderCreditAudit(Long orderCode) {
		ResponseResult<OrderAuditVo> result = new ResponseResult<>();
		try {
			result.success(orderExclusivelBffService.getOrderCreditAudit(orderCode));
		} catch (BizException e) {
			logger.error("[getOrderCreditAudit]查询订单审核信息失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[getOrderCreditAudit]查询订单审核信息异常:", e);
			result.error("查询订单审核信息异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属订单-订悦订单首付")
	@PostMapping(value = "/exclusivel/offline/downpay/modify")
	@OptionalLogConfig(methods = "专属订单-订悦订单首付")
	public ResponseResult<Boolean> orderOfflineDownPay(@RequestBody @Valid OrderOfflineDownPayModifyVo modifyVo,
			BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderExclusivelBffService.modifyOrderOfflineDownPay(modifyVo));
		} catch (BizException e) {
			logger.error("[orderOfflineDownPay]专属订单-订悦订单首付操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[orderOfflineDownPay]专属订单-订悦订单首付异常:", e);
			result.error("订单操作异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "专属订单-订悦订单提车")
	@PostMapping(value = "/exclusivel/offline/delivery/modify")
	@OptionalLogConfig(methods = "专属订单-订悦订单提车")
	public ResponseResult<Boolean> orderOfflineDelivery(@RequestBody @Valid OrderOfflineDeliveryModifyVo modifyVo,
			BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderExclusivelBffService.modifyOrderOfflineDelivery(modifyVo));
		} catch (BizException e) {
			logger.error("[orderOfflineDelivery]专属订单-订悦订单提车操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[orderOfflineDelivery]专属订单-订悦订单提车异常:", e);
			result.error("订单操作异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "退租申请(同意退租)")
	@PostMapping(value = "/exclusivel/renege/create")
	@OptionalLogConfig(methods = "退租订单退租申请(同意退租)")
	public ResponseResult<Boolean> createOrderRenege(@RequestBody @Valid OrderRenegeCreateVo createVo
			, BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			createVo.setRenegeType(OrderRenegeTypeEnum.INITIATIVE.getValue());
			result.success(orderRenegeBffService.createRenege(createVo));
		} catch (BizException e) {
			logger.error("[createOrderRenege]退租申请(同意退租)操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[createOrderRenege]退租申请(同意退租)操作异常:", e);
			result.error("退租申请操作异常");
		}

		return result;
	}

	/**
	 * 取消退租
	 *
	 * @param orderRenegeCancelModifyVo
	 * @return
	 */
	@Override
	@ApiOperation(value = "取消退租")
	@PostMapping(value = "/exclusivel/renege/cancel")
	@OptionalLogConfig(methods = "退租订单取消退租")
	public ResponseResult<Boolean> modifyOrderCancel(@RequestBody @Valid OrderRenegeCancelModifyVo orderRenegeCancelModifyVo) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderRenegeBffService.modifyCancel(orderRenegeCancelModifyVo));
		} catch (BizException e) {
			logger.error("[modifyOrderCancel]取消退租操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[modifyOrderCancel]取消退租操作异常:", e);
			result.error("取消退租操作异常");
		}

		return result;
	}

	/**
	 * 发起收/付款
	 *
	 * @param orderRenegeCostModifyVo
	 * @return
	 */
	@Override
	@ApiOperation(value = "发起收/付款")
	@PostMapping(value = "/exclusivel/renege/cost")
	@OptionalLogConfig(methods = "退租订单发起收/付款")
	public ResponseResult<Boolean> modifyOrderCost(@RequestBody @Valid OrderRenegeCostModifyVo orderRenegeCostModifyVo) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderRenegeBffService.modifyCost(orderRenegeCostModifyVo));
		} catch (BizException e) {
			logger.error("[modifyOrderCost]发起收/付款操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[modifyOrderCost]发起收/付款操作异常:", e);
			result.error("发起收/付款操作异常");
		}

		return result;
	}

	/**
	 * 退款完成
	 *
	 * @param orderRenegeCompleteModifyVo
	 * @return
	 */
	@Override
	@ApiOperation(value = "退款完成")
	@PostMapping(value = "/exclusivel/renege/complete")
	@OptionalLogConfig(methods = "退租订单退款完成")
	public ResponseResult<Boolean> modifyOrderComplete(@RequestBody @Valid OrderRenegeCompleteModifyVo orderRenegeCompleteModifyVo) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderRenegeBffService.modifyComplete(orderRenegeCompleteModifyVo));
		} catch (BizException e) {
			logger.error("[modifyOrderComplete]退款完成操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[modifyOrderComplete]退款完成操作异常:", e);
			result.error("退款完成操作异常");
		}

		return result;
	}

	/**
	 * 查询订单退租信息
	 *
	 * @param orderCode
	 * @param userId
	 * @return
	 */
	@Override
	@ApiOperation(value = "查询订单退租信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "userId", value = "用户id", required = true, dataType = "Integer")
	})
	@GetMapping(value = "/exclusivel/renege/info")
	public ResponseResult<OrderRenegeVo> getOrderRenege(Long orderCode, Integer userId) {
		ResponseResult<OrderRenegeVo> result = new ResponseResult<>();
		try {
			result.success(orderRenegeBffService.getOrderRenege(orderCode, userId));
		} catch (BizException e) {
			logger.error("[getOrderRenege]查询订单退租信息操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[getOrderRenege]查询订单退租信息操作异常:", e);
			result.error("查询订单退租信息操作异常");
		}

		return result;
	}

	/**
	 * 根据订单code查询 提车单信息（安鹏）
	 *
	 * @param orderCode
	 * @return
	 */
	@Override
	@ApiOperation(value = "根据订单code查询 提车单信息（安鹏）")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long")
	})
	@GetMapping(value = "/exclusivel/delivery/info")
	public ResponseResult<DeliveryVo> getDelivery(Long orderCode) {
		ResponseResult<DeliveryVo> result = new ResponseResult<>();
		try {
			result.success(contractBffService.getDelivery(orderCode));
		} catch (BizException e) {
			logger.error("[getDelivery]查询 提车单信息（安鹏）操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[getDelivery]查询 提车单信息（安鹏）异常:", e);
			result.error("查询 提车单信息（安鹏）操作异常");
		}

		return result;
	}

	/**
	 * 根据订单code查询 费用记录（安鹏）
	 *
	 * @param orderCode
	 * @return
	 */
	@Override
	@ApiOperation(value = "根据订单code查询 费用记录（安鹏）")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long")
	})
	@GetMapping(value = "/exclusivel/anpeng/payment/record")
	public ResponseResult<OfflineBookyueVo> getOfflineBookyue(Long orderCode) {
		ResponseResult<OfflineBookyueVo> result = new ResponseResult<>();
		try {
			result.success(escrowLogBffService.getOfflineBookyue(orderCode));
		} catch (BizException e) {
			logger.error("[getOfflineBookyue]根据订单code查询 费用记录（安鹏）操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[getOfflineBookyue]根据订单code查询 费用记录（安鹏）操作异常:", e);
			result.error("根据订单code查询 费用记录（安鹏）操作异常");
		}

		return result;
	}

	/**
	 * List cars mileage monitoring response result.
	 * 订单-里程监控-车辆月度里程
	 * @param map the map
	 * @return the response result
	 * @author wanghualin
	 */
	@ApiOperation(value = "订单-里程监控-车辆月度里程列表")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "enterpriseId", value = "企业Id", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "vin", value = "订单号", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "pageNum", value = "当前页", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "pageSize", value = "页大小", required = true, dataType = "Long")
	})
	@GetMapping(value = "/mileage/monitoring/list")
	@Override
	public ResponseResult<Paged<CarsMileageMonitoringEnterpriseVo>> listCarsMileageMonitoring(@RequestParam Map<String, Object> map, Integer pageNum, Integer pageSize) {

		ResponseResult<Paged<CarsMileageMonitoringEnterpriseVo>> result = new ResponseResult<>();
		try {
			result.success(monitoringService.listCarsMileageMonitoring(map, pageNum,  pageSize));
		} catch (BizException e) {
			logger.error("[listCarsMileageMonitoring]订单-里程监控-车辆月度里程:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[listCarsMileageMonitoring]订单-里程监控-车辆月度里程:", e);
			result.error("订单-里程监控-车辆月度里程异常");
		}
		return result;
	}

	/**
	 * List cars mileage warn enterprise response result.
	 * 订单-里程监控-超程报警列表
	 *
	 * @param map the map
	 * @return the response result
	 * @author wanghualin
	 */
	@GetMapping(value = "/mileage/monitoring/alarm/list")
	@ApiOperation(value = "订单-里程监控-超程报警")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "orderCode", value = "订单号", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "enterpriseId", value = "企业Id", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "vin", value = "订单号", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "status", value = "报警状态 0：未处理 1：已处理", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "pageNum", value = "当前页", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "pageSize", value = "页大小", required = true, dataType = "Long")
	})
	@Override
	public ResponseResult<Paged<CarsMileageWarnEnterpriseVo>> listCarsMileageWarnEnterprise(@RequestParam Map<String, Object> map, Integer pageNum, Integer pageSize) {
		ResponseResult<Paged<CarsMileageWarnEnterpriseVo>> result = new ResponseResult<>();
		try {
			result.success(monitoringService.listCarsMileageWarnEnterprise(map, pageNum,  pageSize));
		} catch (BizException e) {
			logger.error("[listCarsMileageMonitoring]订单-里程监控-超程报警列表:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[listCarsMileageMonitoring]订单-里程监控-超程报警列表:", e);
			result.error("订单-里程监控-超程报警列表");
		}
		return result;
	}
	/**
	 * List cars mileage warn enterprise response result.
	 * 订单-里程监控-超程报警列表
	 *
	 * @param map the map
	 * @return the response result
	 * @author wanghualin
	 */
    @OptionalLogConfig(methods="订单-里程监控-超程处理")
	@PostMapping(value = "/mileage/monitoring/alarm/update")
	@ApiOperation(value = "订单-里程监控-超程处理")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "id", value = "订单号", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "status", value = "报警状态 0：未处理 1：已处理", required = true, dataType = "Long"),
			@ApiImplicitParam(name = "note", value = "未处理意见", required = true, dataType = "String"),
	})
	@Override
	public ResponseResult updateCarsMileageWarnEnterprise(@RequestBody Map<String, Object> map) {
		try {
			return monitoringService.updateCarsMileageWarnEnterprise(map);
		}catch (Exception e){
			return new ResponseResult().error("操作异常");
		}


	}
	/**
	 * List cars mileage warn enterprise response result.
	 * 订单-里程监控-超程报警列表
	 *
	 * @param map the map
	 * @return the response result
	 * @author wanghualin
	 */
	@OptionalLogConfig(methods="订单-里程监控-超程处理-详情")
	@GetMapping(value = "/mileage/monitoring/alarm/details")
	@ApiOperation(value = "订单-里程监控-超程处理-详情")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "id", value = "报警id", required = true, dataType = "Long"),
	})
	@Override
	public ResponseResult getCarsMileageWarnEnterprise(@RequestParam Map<String, Object> map) {
		CarsMileageWarnEnterpriseVo vo= monitoringService.getCarsMileageWarnEnterprise(map);
		ResponseResult<CarsMileageWarnEnterpriseVo> result = new ResponseResult<>();
		return result.success(vo);
	}

	@Override
	@ApiOperation(value = "订单协商退租列表")
	@ApiImplicitParams({@ApiImplicitParam(name = "orderCode", value = "订单号", dataType = "Long"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机", dataType = "String"),
			@ApiImplicitParam(name = "orderStatus", value = "订单状态(30: 待还车, 31: 财务结算中, 32: 解除协议确认, 33: 收/退款, 34: 退租已完成)", dataType = "Integer"),
			@ApiImplicitParam(name = "recycleState", value = "收车状态(0：未收车，1：收车失败，2：已收车，3：已丢失，4：已报废，5：已售出)", dataType = "Integer"),
			@ApiImplicitParam(name = "renegeTimeStart", value = "退租时间", dataType = "String"),
			@ApiImplicitParam(name = "renegeTimeEnd", value = "退租时间", dataType = "String"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer")
	})
	@GetMapping(value = "/exclusivel/renege/negotiate/list")
	public ResponseResult<Paged<OrderNegotiateRenegeVo>> getNegotiateRenegeList(@RequestParam Map<String, Object> selectParams,
	                                                                            @RequestParam(defaultValue = "1") Integer pageNum,
	                                                                            @RequestParam(defaultValue = "10") Integer pageSize) {
		ResponseResult<Paged<OrderNegotiateRenegeVo>> result = new ResponseResult<>();
		try {
			result.success(orderRenegeBffService.getNegotiateRenegeList(selectParams,
					pageNum, pageSize));
		} catch (BizException e) {
			logger.error("[getNegotiateRenegeList]查询订单协商退租列表异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[getNegotiateRenegeList]查询订单协商退租列表异常:", e);
			result.error("查询订单协商退租列表异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "法务诉讼列表")
	@ApiImplicitParams({@ApiImplicitParam(name = "orderCode", value = "订单号", dataType = "Long"),
			@ApiImplicitParam(name = "userRealName", value = "用户姓名", dataType = "String"),
			@ApiImplicitParam(name = "userPhone", value = "用户手机", dataType = "String"),
			@ApiImplicitParam(name = "lawsuitState", value = "诉讼状态(1：诉讼中，2：已完成诉讼)", dataType = "Integer"),
			@ApiImplicitParam(name = "recycleState", value = "收车状态(0：未收车，1：收车失败，2：已收车，3：已丢失，4：已报废，5：已售出)", dataType = "Integer"),
			@ApiImplicitParam(name = "lawsuitTimeStart", value = "诉讼时间", dataType = "String"),
			@ApiImplicitParam(name = "lawsuitTimeEnd", value = "诉讼时间", dataType = "String"),
			@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "Integer")
	})
	@GetMapping(value = "/exclusivel/lawsuit/list")
	public ResponseResult<Paged<OrderLawsuitVo>> getLawsuitList(@RequestParam Map<String, Object> selectParams,
	                                                            @RequestParam(defaultValue = "1") Integer pageNum,
	                                                            @RequestParam(defaultValue = "10") Integer pageSize) {
		ResponseResult<Paged<OrderLawsuitVo>> result = new ResponseResult<>();
		try {
			result.success(orderLawsuitBffService.getLawsuitList(selectParams,
					pageNum, pageSize));
		} catch (BizException e) {
			logger.error("[getLawsuitList]查询法务诉讼列表异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[getLawsuitList]查询法务诉讼列表异常:", e);
			result.error("查询法务诉讼列表异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "协商退租")
	@PostMapping(value = "/exclusivel/renege/negotiate")
	@OptionalLogConfig(methods = "协商退租")
	public ResponseResult<Boolean> createNegotiateRenege(@RequestBody @Valid OrderRenegeCreateVo createVo,
	                                                     BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			createVo.setRenegeType(OrderRenegeTypeEnum.NEGOTIATE.getValue());
			result.success(orderRenegeBffService.createRenege(createVo));
		} catch (BizException e) {
			logger.error("[createNegotiateRenege]协商退租操作异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[createNegotiateRenege]协商退租操作异常:", e);
			result.error("协商退租操作异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "法务诉讼")
	@PostMapping(value = "/exclusivel/lawsuit")
	@OptionalLogConfig(methods = "法务诉讼")
	public ResponseResult<Boolean> createLawsuit(@RequestBody @Valid OrderLawsuitCreateVo createVo,
	                                             BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderLawsuitBffService.createLawsuit(createVo));
		} catch (BizException e) {
			logger.error("[createLawsuit]法务诉讼操作异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[createLawsuit]法务诉讼操作异常:", e);
			result.error("法务诉讼操作异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "完成诉讼")
	@PostMapping(value = "/exclusivel/lawsuit/complete")
	@OptionalLogConfig(methods = "完成诉讼")
	public ResponseResult<Boolean> modifyLawsuitComplete(@RequestBody @Valid OrderLawsuitModifyVo modifyVo,
	                                                     BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			result.success(orderLawsuitBffService.modifyLawsuitComplete(modifyVo));
		} catch (BizException e) {
			logger.error("[modifyLawsuitComplete]完成诉讼操作失败:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[modifyLawsuitComplete]完成诉讼操作异常:", e);
			result.error("完成诉讼操作异常");
		}

		return result;
	}

	/**
	 * 订单确认收车
	 *
	 * @param createVo
	 * @param bindingResult
	 * @return
	 */
	@Override
	@ApiOperation(value = "订单确认收车")
	@PostMapping(value = "/exclusivel/recycle/cars")
	@OptionalLogConfig(methods = "订单确认收车")
	public ResponseResult<Boolean> createRecycleCars(@RequestBody @Valid OrderRecycleCarsCreateVo createVo,
	                                                 BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
            result.success(orderRenegeBffService.createRecycleCars(createVo));
		} catch (BizException e) {
			logger.error("[createRecycleCars]确认收车操作异常:", e);
			result.error(e.getExceptionCode(), e.getMessage());
		} catch (Exception e) {
			logger.error("[createRecycleCars]确认收车操作异常:", e);
			result.error("确认收车操作异常");
		}

		return result;
	}

	@Override
	@ApiOperation(value = "退租完成")
	@PostMapping(value = "/exclusivel/renege/finish")
	@OptionalLogConfig(methods = "退租订单退租完成")
	public ResponseResult<Boolean> modifyRenegeFinish(@RequestBody @Valid OrderRenegeCompleteModifyVo orderRenegeCompleteModifyVo,
	                                                  BindingResult bindingResult) {
		ResponseResult<Boolean> result = new ResponseResult<>();
		try {
			boolean rst = orderRenegeBffService.modifyRenegeFinish(orderRenegeCompleteModifyVo);
			result = rst ? result.success() : result.error("退租完成操作失败");
		} catch (BizException e) {
			logger.error("[modifyRenegeFinish]退租订单退租完成操作失败:", e);
			result.error(e.getExceptionCode() == null ? ResponseCodeEnum.UNKNOWN_ERROR.getCode() : e.getExceptionCode(),
					e.getMessage());
		} catch (Exception e) {
			logger.error("[modifyRenegeFinish]退租订单退租完成操作异常:", e);
			result.error("退租完成操作异常");
		}

		return result;
	}

}
